#include <stdio.h>
#define N 20
int  match (char *exp){
    char stack[N];
    int top = -1;
    int i = 0;
    while(exp[i]!='\0'){
        if(exp[i] == '(' || exp[i] == '{' || exp[i] == '['){
            stack[++top] = exp[i];
        } else if (exp[i] == ')' || exp[i] == ']' || exp[i] == '}'){
            if(top == -1){
                return 0;
            }
            char topChar = stack[top--];
            if(topChar != '(' && exp[i]==')' || topChar != '[' && exp[i]==']' || topChar != '{' && exp[i]=='}'){
                return 0;
            }
        }
        i++;
    }
    return -1;
}

int main()
{
    char s[N];
    int flag;
    scanf("%s",s);
    flag=match(s);
    if(flag)
        printf("%s match",s);
    else
        printf("%s not match",s);
    return 0;
}

/* 请在这里填写答案 */